<template>
	<view class="container">
		<view class="header" >
			<view class="headerimg"><image class="bgimg" :src="imgBaseUrl+'/ache/images/bgimg.png'"></image></view>
			<view class="headersearch">
				<image class="logoimg" :src="imgBaseUrl+'/ache/images/logo.png'"></image>
				<view class="search-wrapper">
					<view class="input-wrapper">
						<input class="input" type="text" @confirm="onSearch" v-model="value"   placeholder="请输入产品名称"/>
						<u-icon class="iconfont " name="search"></u-icon>
					</view>
					<view class="button" @click="onSearch">搜索</view>
				</view>
				<view class="wrap"><u-swiper :list="list" height="280" @click="onbanner(list)"></u-swiper></view>
			</view>
		</view>
		<view class="title"><text class="text">为您推荐</text></view>
		<goods></goods>
	</view>
</template>
<script>
import goods from '@/components/goods/index.vue'
import { mapGetters } from 'vuex';
export default {
	components:{
		goods
	},
	computed: {
		...mapGetters(['imgBaseUrl'])
	},
	data() {
		return {
			value: '', //搜索值
			url: 'https://peonyoss.longchimudan.com', //阿里oss地址
			list: [
				{
					image: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
				},
				{
					image: 'https://cdn.uviewui.com/uview/swiper/2.jpg'
				},
				{
					image: 'https://cdn.uviewui.com/uview/swiper/3.jpg'
				}
			],
		};
	},
	created() {
		console.log(this.imgBaseUrl,'sssssssssssssssssssssssss')
	},

	methods: {
		//搜索
		onSearch() {
			console.log(this.value, '搜索的值');
		},
		//点击banner
		onbanner(index) {
			console.log(index, '点击了第几章');
		},
		onGood(item) {
			console.log(item, '点击了商品');
		}
	}
};
</script>

<style lang="scss">
@import '@/styles/mixin.scss';
.container {
	min-height: 100%;
	background-color: #f5f5f5;
	.headerimg {
		position: absolute;
		width: 100%;
		height: 420rpx;
		border-radius: 0rpx 0rpx 80rpx 80rpx;
		background-color: #f53942;
		.bgimg {
			display: flex;
			float: right;
			width: 342rpx;
			height: 365rpx;
		}
	}
	.headersearch {
		padding-top: 80rpx;
		overflow: hidden;
		.logoimg {
			padding-top: 50rpx;
			padding-left: 40rpx;
			display: flex;
			width: 159rpx;
			height: 53rpx;
		}
		.search-wrapper {
			display: flex;
			align-items: stretch;
			padding-top: 20rpx;
			margin: 20rpx;
		}
		.input-wrapper {
			position: relative;
			flex: 1;
			.input {
				width: 100%;
				background-color: #ffffff;
				opacity: 0.8;
				height: 70rpx;
				border-radius: 60rpx 0 0 60rpx;
				padding-left: 60rpx;
			}
			.iconfont {
				position: absolute;
				top: 50%;
				transform: translateY(-50%);
				left: 20rpx;
			}
		}
		.button {
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 0 50rpx;
			background-color: #fd7777;
			border-radius: 0 60rpx 60rpx 0;
			color: #ffffff;
			opacity: 0.8;
		}
		.wrap {
			padding: 20rpx;
		}
	}
	.title {
		margin: 20rpx;
		font-weight: bold;
		text-align: center;
		.text {
			font-size: 30rpx;
		}
	}
}
</style>
